#!/usr/bin/tclsh

proc run_all { cmd } {
    set file_list [glob *.fc]
    foreach {afile} $file_list {
	puts $afile
	if { [catch { exec $cmd < $afile 2&>1 | tee "$afile.out" }]} { 
	    puts "An error occured while executing $cmd < $afile"
	}
    }
}

set command {../ast_fcalc}
run_all $command

